<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>新建一个 OAuth 对象</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="class.oauth.html">« OAuth</a></li>
      <li style="float: right;"><a href="oauth.destruct.html">OAuth::__destruct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.oauth.html">OAuth</a></li>
    <li>新建一个 OAuth 对象</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="oauth.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">OAuth::__construct</h1>
  <p class="verinfo">(PECL OAuth &gt;= 0.99.1)</p><p class="refpurpose"><span class="refname">OAuth::__construct</span> &mdash; <span class="dc-title">新建一个 OAuth 对象</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-oauth.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>OAuth::__construct</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$consumer_key</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$consumer_secret</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$signature_method</code><span class="initializer"> = <strong><code>OAUTH_SIG_METHOD_HMACSHA1</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$auth_type</code><span class="initializer"> = 0</span></span><br>)</div>

  <p class="para rdfs-comment">
新建一个 OAuth 对象
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-oauth.construct-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">consumer_key</code></dt>

     <dd>

      <p class="para">
       由服务提供者提供的 consumer key 。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">consumer_secret</code></dt>

     <dd>

      <p class="para">
       由服务提供者提供的 consumer secret 。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">signature_method</code></dt>

     <dd>

      <p class="para">
       可选参数，用来定义使用哪种签名方法，默认为 <strong><code>OAUTH_SIG_METHOD_HMACSHA1</code></strong> （HMAC-SHA1）。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">auth_type</code></dt>

     <dd>

      <p class="para">
       可选参数，用来定义如何传递 OAuth 参数给消费方，默认为<strong><code>OAUTH_AUTH_TYPE_AUTHORIZATION</code></strong> （在  <code class="literal">Authorization</code> 头部）。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


</div></div></div></body></html>